@model VotingSystem.Models.SurveyQuestion

@{
    ViewData["Title"] = "编辑问题";
}

<div class="container">
    <h1>编辑问题</h1>

    <div class="row">
        <div class="col-md-8">
            <form asp-action="Edit">
                <div asp-validation-summary="ModelOnly" class="text-danger"></div>
                <input type="hidden" asp-for="Id" />
                <input type="hidden" asp-for="SurveyId" />

                <div class="form-group mb-3">
                    <label asp-for="QuestionText" class="control-label">问题内容</label>
                    <textarea asp-for="QuestionText" class="form-control" rows="3"></textarea>
                    <span asp-validation-for="QuestionText" class="text-danger"></span>
                </div>

                <div class="form-group mb-3">
                    <label asp-for="Type" class="control-label">问题类型</label>
                    <select asp-for="Type" class="form-select" asp-items="Html.GetEnumSelectList<QuestionType>()"></select>
                    <span asp-validation-for="Type" class="text-danger"></span>
                </div>

                <div class="form-group mb-3">
                    <div class="form-check">
                        <input asp-for="IsRequired" class="form-check-input" />
                        <label asp-for="IsRequired" class="form-check-label">必答题</label>
                    </div>
                </div>

                <div class="form-group mb-3">
                    <label asp-for="Order" class="control-label">问题顺序</label>
                    <input asp-for="Order" class="form-control" type="number" min="1" />
                    <span asp-validation-for="Order" class="text-danger"></span>
                </div>

                <div class="form-group">
                    <input type="submit" value="保存" class="btn btn-primary" />
                    <a asp-controller="Surveys" asp-action="Details" asp-route-id="@Model.SurveyId" class="btn btn-secondary">返回问卷</a>
                </div>
            </form>
        </div>
    </div>
</div>

@section Scripts {
    @{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
} 